<template>
    <div>
        <div> 子组件</div>
        <h3>{{ params }}</h3>
        <h3>{{ testMsg }}</h3>
        <h3>{{ test }}</h3>
    </div>
    <img v-bind="$attrs">
    <div v-bind="$attrs">
        继承
    </div>
</template>

<script setup>
// 通过 defineExpose 抛出
// 通过 defineProps 接受数据
//穿透 子组件通过 inject 接受
import { defineProps, ref, defineExpose, inject } from 'vue'
const props = defineProps({
    params: {
        type: String,
        default: 'default'
    }
})

const test = inject('test')

const testMsg = ref('测试')
defineExpose({ testMsg })
</script>